package qr.game;

import java.io.IOException;
import java.util.List;

import android.location.Address;
import android.location.Geocoder;
import android.os.Bundle;

import com.google.android.maps.GeoPoint;
import com.google.android.maps.MapActivity;
import com.google.android.maps.MapController;
import com.google.android.maps.MapView;

public class ViewMapActivity extends MapActivity {

	@Override
	public void onCreate(Bundle savedInstanceState) {
	    super.onCreate( savedInstanceState );
		setContentView( R.layout.map_layout );
		MapView mapView = (MapView) findViewById( R.id.mapview );
		mapView.setBuiltInZoomControls(true);
		MapController controller = mapView.getController();
		try{
			Geocoder geocoder = new Geocoder(getBaseContext());
			List<Address> addrs = geocoder.getFromLocationName("1 Lomb Memorial Drive, Rochester, NY 12946", 1);
			int lat = (int) (addrs.get(0).getLatitude() * 1E6);
			int lon = (int) (addrs.get(0).getLatitude() * 1E6);
			controller.setCenter( new GeoPoint(lat, lon) );
		}catch( IOException e ){
			e.printStackTrace();
		}
	}

	@Override
	protected boolean isRouteDisplayed() {
		return false;
	}

}
